$(function() {
	$("#left").load("../../page/common/left.html");
	var deptId;
	var serId;
	v_list = new Vue({
		el: '#advice-index',
		data: {
			dto: {
				userId: '',
				mobile: '',
				name: '',
				sex: '',
				nation: '',
				birthday: '',
				address: '',
				cardNum: '',
				issued: '',
				life: ''
			},
			deptId: '',
			serId: '',
			theme: '',
			content: '',
			deptList: [],
			serList: [],
			itemsList: []
		},
		methods: {
			save: function() {
				if(this.theme == '') {
					showRedMsg("message", "请填写建议主题!");
					return false;
				} else if(this.theme.trim() == '') {
					showRedMsg("message", "请填写建议主题!");
					return false;
				}
				console.log("1111"+illegalSign(this.theme));
				if(illegalSign(this.theme) =='true'){
					showRedMsg("", "不要填入特殊符号  如 # & ^ $");
				}
				if(this.content == '') {
					showRedMsg("message", "请填写建议内容!");
					return false;
				} else if(this.content.trim() == '') {
					showRedMsg("message", "请填写建议内容!");
					return false;
				}
				if(illegalSign(this.content) =='true'){
					showRedMsg("", "不要填入特殊符号  如 # & ^ $");
				}
				console.log("userId:" + this.dto.userId + "deptId:" + this.deptId + "serId:" + this.serId + "theme:" + this.theme + "content:" + this.content)
				this.$http.post(complain.saveComplain, {
					type: "3",
					userId: this.dto.userId,
					deptId: this.deptId,
					serId: this.serId,
					theme: this.theme.trim(),
					content: this.content.trim()
				}, {
					emulateJSON: true
				}).then(function(res) {
					//接收后端传来的数据
					doMask()
					console.log(toJson(res.data));
					if(res.data.success) {
						unMask();
						window.location.href = 'advice-result.html';
					} else {
						unMask();
						showRedMsg("message", "保存出错");
					}
				}, function(res) {
					unMask();
					showRedMsg("message", "保存出错");
					console.log("保存出错:" + toJson(res));
				});
			}
		},
		ready: function() {
			//初始化获得总页面数和列表数据
			this.dto = toObj(sessionStorage.getItem("dto"));
			 
			 
		}
	});
})